package com.guchenbo.springboot;

import java.io.IOException;
import java.util.Random;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * @author guchenbo
 * @date 2022/6/27
 */
@Service
public class DemoService {

    @Resource
    private DemoWebSocketHandler webSocketHandler;

    public String count() {
        return String.valueOf(new Random().nextInt(100));
    }

    public void change(String account) throws IOException {
        webSocketHandler.sendMsg(account, count());
    }
}
